<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="keywords" content="">
    <meta name="description" content="">
    <meta name="author" content="">
    <title>集团电商</title>
    <!--common-->
    <link href="__CSS__/bootstrap.min.css" rel="stylesheet">
    <script src="__JS__/jquery-2.2.3.min.js"></script>
</head>
<body class="sticky-header">
<div class="container" style="padding-top: 10px;">
    <div class="main-title">
        <h2>设置角色相关状态</h2>
    </div>

    <div id="auth_groups">
        <form class="form-horizontal" action="{:url('setstates')}" method="post">
            <div class="form-group" style="font-weight: bold;">{$authgroup.title} 的状态授权</div>
            <div class="form-group">
                <div style="font-size: 16px;color: #9f191f">设置具有编辑权限的状态</div>
                {volist name="statedata" id="vo"}
                <label class="checkbox-inline">
                    <input class="caneditstates" type="checkbox" name="caneditstates[]" value="{$vo.id}">{$vo.name}
                </label>
                {/volist}
            </div>
            <div class="form-group">
                <div style="font-size: 16px;color: #9f191f">设置编辑的状态</div>
                {volist name="statedata" id="vo"}
                <label class="checkbox-inline">
                    <input class="editstates" type="checkbox" name="editstates[]" value="{$vo.id}">{$vo.name}
                </label>
                {/volist}
            </div>
            <div class="form-group">
                <div style="font-size: 16px;color: #9f191f"> 是否对 {$authgroup.title} 信息保密</div>
                <input type="radio" name="baomi" value="1" {eq name="authgroup.baomi" value="1"}checked{/eq} >是&nbsp;&nbsp;&nbsp;
                <input type="radio" name="baomi" value="0" {eq name="authgroup.baomi" value="0"}checked{/eq} >否
            </div>
            <div class="form-group">
                <div style="font-size: 16px;color: #9f191f">设置信息保密的状态</div>
                {volist name="statedata" id="vo"}
                <label class="checkbox-inline">
                    <input class="hidstates" type="checkbox" name="hidstates[]" value="{$vo.id}">{$vo.name}
                </label>
                {/volist}
            </div>
            <input type="hidden" name="auth_id" value="{$authgroup.id}">
            <input type="hidden" name="batch" value="true">
            <div style="margin-top: 10px;" class="form-group">
                <button type="submit" class="btn btn-success">确 定</button>
            </div>
        </form>
    </div>
    <!--body wrapper end-->
</div>
<script type="text/javascript">
    $(function(){
        var caneditstates = [{$authgroup.caneditstates}];
        var editstates = [{$authgroup.editstates}];
        var hidstates = [{$authgroup.hidstates}];
        $('.caneditstates').each(function(){
            if( $.inArray( parseInt(this.value,10),caneditstates )>-1 ){
                $(this).prop('checked',true);
            }
        });
        $('.editstates').each(function(){
            if( $.inArray( parseInt(this.value,10),editstates )>-1 ){
                $(this).prop('checked',true);
            }
        });
        $('.hidstates').each(function(){
            if( $.inArray( parseInt(this.value,10),hidstates )>-1 ){
                $(this).prop('checked',true);
            }
        });
    });
</script>
</body>
</html>